package dk.pekilidi.webapp.action;

import java.io.Serializable;
import java.util.List;

import dk.pekilidi.model.MBean;
import org.appfuse.service.GenericManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * User: msp
 * Date: 04-12-12
 * Time: 10:11
 */
@Scope("request")
@Component("mBeanList")
public class MBeanList extends BasePage implements Serializable{

    private GenericManager<MBean, Long> mbeanManager;

    @Autowired
    public void setMBeanManager(@Qualifier("mbeanManager") GenericManager<MBean, Long> mbeanManager) {
        this.mbeanManager = mbeanManager;
    }

    public MBeanList() {
        setSortColumn("id"); // sets the default sort column
    }

    public List getMbeans() {
        return sort(mbeanManager.getAll());
    }
}
